/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* Copyright (c) 1999-2007 IVT Corporation
*
* All rights reserved.
* 
---------------------------------------------------------------------------*/
 
/////////////////////////////////////////////////////////////////////////////
// Module Name:
//     Btsdk_Stru.h
// Abstract:
//     This module defines BlueSoleil SDK structures.
// Usage:
//     #include "Btsdk_Stru.h"
// 
// Author://     
//     
// Revision History:
//     2007-12-25		Created
// 
/////////////////////////////////////////////////////////////////////////////



#ifndef _BTSDK_STRU_H
#define _BTSDK_STRU_H


/*************** Structure Definition ******************/ 

typedef struct  _BtSdkCallbackStru
{
	BTUINT16 type;					/*type of callback*/
	void *func;						/*callback function*/
}BtSdkCallbackStru, *PBtSdkCallbackStru;

typedef struct _BtSdkLocalLMPInfoStru
{
	BTUINT8 lmp_feature[8];				/* LMP features */
	BTUINT16 manuf_name;				/* the name of the manufacturer */
	BTUINT16 lmp_subversion;			/* the sub version of the LMP firmware */
	BTUINT8 lmp_version;				/* the main version of the LMP firmware */
	BTUINT8 hci_version;				/* HCI version */
	BTUINT16 hci_revision;				/* HCI revision */
	BTUINT8 country_code;				/* country code */
} BtSdkLocalLMPInfoStru, *PBtSdkLocalLMPInfoStru;

typedef struct _BtSdkVendorCmdStru
{
	BTUINT16 ocf;			/* OCF Range (10 bits): 0x0000-0x03FF */
	BTUINT8	 param_len;		/* length of param in bytes */
	BTUINT8	 param[1];		/* Parameters to be packed in the vendor command. Little endian is adopted. */
} BtSdkVendorCmdStru, *PBtSdkVendorCmdStru;

typedef struct _BtSdkEventParamStru
{
	BTUINT8 ev_code;		/* Event code. */
	BTUINT8 param_len;		/* length of param in bytes */
	BTUINT8 param[1];		/* Event parameters. */
} BtSdkEventParamStru, *PBtSdkEventParamStru;

typedef struct  _BtSdkRemoteLMPInfoStru
{
	BTUINT8 lmp_feature[8];				/* LMP features */
	BTUINT16 manuf_name; 				/* the name of the manufacturer */
	BTUINT16 lmp_subversion;			/* the sub version of the LMP firmware */
	BTUINT8 lmp_version; 				/* the main version of the LMP firmware */
} BtSdkRemoteLMPInfoStru, *PBtSdkRemoteLMPInfoStru;

typedef struct _BtSdkRemoteDevicePropertyStru
{
	BTUINT32 mask;								/*Specifies members available.*/
	BTDEVHDL dev_hdl;							/*Handle assigned to the device record*/
	BTUINT8 bd_addr[BTSDK_BDADDR_LEN];			/*BT address of the device record*/
	BTUINT8 name[BTSDK_DEVNAME_LEN];			/*Name of the device record, must be in UTF-8*/
	BTUINT32 dev_class;							/*Device class*/
	BtSdkRemoteLMPInfoStru lmp_info;			/* LMP info */
	BTUINT8	link_key[BTSDK_LINKKEY_LEN];		/* link key for this device. */
} BtSdkRemoteDevicePropertyStru;  
typedef BtSdkRemoteDevicePropertyStru* PBtSdkRemoteDevicePropertyStru;

/* Parameters of Hold_Mode command */
typedef struct _BtSdkHoldModeStru {
	BTUINT16 conn_hdl;					/* reserved, set it to 0. */
	BTUINT16 max;						/* Hold mode max interval. */
	BTUINT16 min;						/* Hold mode min interval. */
} BtSdkHoldModeStru;
typedef BtSdkHoldModeStru* PBtSdkHoldModeStru;

/* Parameters of Sniff_Mode command */
typedef struct _BtSdkSniffModeStru {
	BTUINT16 conn_hdl;					/* reserved, set it to 0. */
	BTUINT16 max;						/* Sniff mode max interval. */
	BTUINT16 min;						/* Sniff mode min interval. */
	BTUINT16 attempt;					/* Sniff mode attempt value. */
	BTUINT16 timeout;					/* Sniff mode timeout value. */
} BtSdkSniffModeStru;
typedef BtSdkSniffModeStru* PBtSdkSniffModeStru;

/* Parameters of Park_Mode (V1.1) or Park_State (V1.2) command */
typedef struct _BtSdkParkModeStru {
	BTUINT16 conn_hdl;					/* reserved, set it to 0. */
	BTUINT16 max;						/* Beacon max interval. */
	BTUINT16 min;						/* Beacon min interval. */
} BtSdkParkModeStru;
typedef BtSdkParkModeStru* PBtSdkParkModeStru;

/* Basic SDP Element */
typedef struct _BtSdkUUIDStru
{
    BTUINT32 Data1;
    BTUINT16 Data2;
    BTUINT16 Data3;
    BTUINT8  Data4[8];
} BtSdkUUIDStru, *PBtSdkUUIDStru;

typedef struct _BtSdkSDPSearchPatternStru
{
	BTUINT32 mask;					/*Specifies the valid bytes in the uuid*/
	BtSdkUUIDStru uuid;				/*UUID value*/
} BtSdkSDPSearchPatternStru, *PBtSdkSDPSearchPatternStru;

/* Remote service record attributes */
typedef struct _BtSdkRemoteServiceAttrStru
{
	BTUINT16 mask;									/*Decide which parameter to be retrieved*/
	union
	{
		BTUINT16 svc_class;							/* For Compatibility */
		BTUINT16 service_class;
	};												/*Type of this service record*/
	BTDEVHDL dev_hdl;								/*Handle to the remote device which provides this service.*/
	BTUINT8 svc_name[BTSDK_SERVICENAME_MAXLENGTH];	/*Service name in UTF-8*/
	BTLPVOID ext_attributes;						/*Free by the APP*/
	BTUINT16 status;
} BtSdkRemoteServiceAttrStru, *PBtSdkRemoteServiceAttrStru;

typedef struct _BtSdkRmtSPPSvcExtAttrStru 
{
	BTUINT32 size;						/*Size of BtSdkRmtSPPSvcExtAttrStru*/
	BTUINT8  server_channel;			/*Server channel value of this SPP service record*/
} BtSdkRmtSPPSvcExtAttrStru, *PBtSdkRmtSPPSvcExtAttrStru;

typedef struct _BtSdkConnectionPropertyStru
{
	BTUINT32 role : 2;
	BTUINT32 result : 30;
	BTDEVHDL device_handle;
	BTSVCHDL service_handle;
	BTUINT16 service_class;
	BTUINT32 duration;
	BTUINT32 received_bytes;
	BTUINT32 sent_bytes;
} BtSdkConnectionPropertyStru, *PBtSdkConnectionPropertyStru;

typedef struct _BtSdkFileTransferReqStru
{
	BTDEVHDL dev_hdl;		/* Handle to the remote device tries to upload/delete the file. */
	BTUINT16 operation;		/* Specify the operation on the file. 
							It can be one of the following values:
								BTSDK_APP_EV_FTP_PUT: The remote device request to upload the file.
								BTSDK_APP_EV_FTP_DEL_FILE: The remote device request to delete the file.
								BTSDK_APP_EV_FTP_DEL_FOLDER: The remote device request to delete the folder. In this case,
															 file_name specify the name of the folder to be deleted.
							*/
	BTUINT16 flag;			/* Flag specifies the current status of uploading/deleting. 
							It can be one of the following values:
								BTSDK_ER_CONTINUE: The remote device request to upload/delete the file. 
								BTSDK_ER_SUCCESS: The remote device uploads/deletes the file successfully. 
								Other value: Error code specifies the reason of uploading/deleting failure. 
							*/
	BTUINT8	 file_name[BTSDK_PATH_MAXLENGTH];	/* the name of the file uploaded/deleted or to be uploaded/deleted */
} BtSdkFileTransferReqStru, *PBtSdkFileTransferReqStru;

typedef struct _BtSdkAppExtSPPAttrStru
{
	BTUINT32			size;									/* Size of this structure */
	BTUINT32			sdp_record_handle;						/* 32bit interger specifies the SDP service record handle */
	BtSdkUUIDStru 		service_class_128;						/* 128bit UUID specifies the service class of this service record */
	BTUINT8				svc_name[BTSDK_SERVICENAME_MAXLENGTH];	/* Service name, in UTF-8 */
	BTUINT8				rf_svr_chnl;							/* RFCOMM server channel assigned to this service record */
	BTUINT8				com_index;								/* Index of the local COM port assigned to this service record */
} BtSdkAppExtSPPAttrStru, *PBtSdkAppExtSPPAttrStru;

/* lParam for SPP */
typedef struct _BtSdkSPPConnParamStru
{
	BTUINT32 size;
	BTUINT16 mask;	//Reserved set 0
	BTUINT8 com_index;
} BtSdkSPPConnParamStru, *PBtSdkSPPConnParamStru;

/* lParam for OPP */
typedef struct _BtSdkOPPConnParamStru
{
	BTUINT32 size;									/*Size of this structure, use for verification and versioning.*/
	BTUINT8 inbox_path[BTSDK_PATH_MAXLENGTH];		/*must in UTF-8*/
	BTUINT8 outbox_path[BTSDK_PATH_MAXLENGTH];		/*must in UTF-8*/
	BTUINT8 own_card[BTSDK_CARDNAME_MAXLENGTH]; 	/*must in UTF-8*/
} BtSdkOPPConnParamStru, *PBtSdkOPPConnParamStru;

/* lParam for DUN */
typedef struct _BtSdkDUNConnParamStru
{ 
	BTUINT32 size;
	BTUINT16 mask;	//Reserved set 0
	BTUINT8 com_index;
} BtSdkDUNConnParamStru, *PBtSdkDUNConnParamStru;

/* lParam for FAX */
typedef struct _BtSdkFAXConnParamStru 
{
	BTUINT32 size;
	BTUINT16 mask;	//Reserved set 0
	BTUINT8 com_index;
} BtSdkFAXConnParamStru, *PBtSdkFAXConnParamStru;


#endif